Ext.define('SKJF.view.PEMBELIAN.v_lunashutang_form', {
	extend	: 'Ext.form.Panel',
	
	alias	: 'widget.v_lunashutang_form',
	
	//region:'east',
	//id: 'east-region-container',
	
	title		: 'Create/Update lunashutang',
    bodyPadding	: 5,
    autoScroll	: true,
    
    initComponent: function(){
    	/*
		 * Deklarasi variable setiap field
		 */
		
		var po_store = Ext.create('SKJF.store.s_po',{autoLoad:true});
		var lpb_store = Ext.create('SKJF.store.s_terimabarang',{autoLoad:true});
		
		var NO_PO_field = Ext.create('Ext.form.field.ComboBox', {
			itemId: 'NO_PO_field',
			name: 'NO_PO', /* column name of table */
			fieldLabel: 'NO_PO',
			pageSize: 10,
			typeAhead    : true,
			triggerAction: 'all',
			selectOnFocus: true,
            loadingText  : 'Searching...',
			store: po_store,
			queryMode: 'local',
			tpl: Ext.create('Ext.XTemplate',
				'<tpl for=".">',
					'<div class="x-boundlist-item">{NOMOR_PO}</div>',
				'</tpl>'
			),
			displayTpl: Ext.create('Ext.XTemplate',
				'<tpl for=".">',
					'{NOMOR_PO}',
				'</tpl>'
			),
			valueField: 'NOMOR_PO',
			displayField: 'NOMOR_PO'
		});
		var NO_LPB_field = Ext.create('Ext.form.field.ComboBox', {
			itemId: 'NO_LPB_field',
			name: 'NO_LPB', /* column name of table */
			fieldLabel: 'NO_LPB',
			pageSize: 10,
			typeAhead    : true,
			triggerAction: 'all',
			selectOnFocus: true,
            loadingText  : 'Searching...',
			store: lpb_store,
			queryMode: 'local',
			tpl: Ext.create('Ext.XTemplate',
				'<tpl for=".">',
					'<div class="x-boundlist-item">{NOMOR_LPB}</div>',
				'</tpl>'
			),
			displayTpl: Ext.create('Ext.XTemplate',
				'<tpl for=".">',
					'{NOMOR_LPB}',
				'</tpl>'
			),
			valueField: 'NOMOR_LPB',
			displayField: 'NOMOR_LPB'
		});
		var NAMA_SUPPLIER_field = Ext.create('Ext.form.field.Text', {
			itemId: 'NAMA_SUPPLIER_field',
			name: 'NAMA_SUPPLIER', /* column name of table */
			fieldLabel: 'NAMA_SUPPLIER',
			allowBlank: false /* jika primary_key */,
			maxLength: 30 /* length of column name */
		});
		var JENIS_BAYAR_field = Ext.create('Ext.form.field.Text', {
			name: 'JENIS_BAYAR', /* column name of table */
			fieldLabel: 'JENIS_BAYAR',
			maxLength: 30 /* length of column name */
		});
		var NOMOR_TRANSAKSI_field = Ext.create('Ext.form.field.Text', {
			name: 'NOMOR_TRANSAKSI', /* column name of table */
			fieldLabel: 'NOMOR_TRANSAKSI',
			maxLength: 20 /* length of column name */
		});
		var TGL_BAYAR_field = Ext.create('Ext.form.field.Date', {
			name: 'TGL_BAYAR', /* column name of table */
			format: 'Y-m-d',
			fieldLabel: 'TGL_BAYAR'
		});
		var JML_BAYAR_field = Ext.create('Ext.ux.form.NumericField', {
			name: 'JML_BAYAR', /* column name of table */
			fieldLabel: 'JML_BAYAR',
			useThousandSeparator: true,
			decimalPrecision: 2,
			alwaysDisplayDecimals: true,
			// currencySymbol: 'Rp',
			thousandSeparator: '.',
			decimalSeparator: ','
		});
		var CURRENCY_field = Ext.create('Ext.form.field.Text', {
			name: 'CURRENCY', /* column name of table */
			fieldLabel: 'CURRENCY',
			maxLength: 3 /* length of column name */
		});		
        Ext.apply(this, {
            fieldDefaults: {
                labelAlign: 'right',
                labelWidth: 120,
                msgTarget: 'qtip',
				anchor: '100%'
            },
			defaultType: 'textfield',
            items: [NO_PO_field,NO_LPB_field,NAMA_SUPPLIER_field,JENIS_BAYAR_field,NOMOR_TRANSAKSI_field,TGL_BAYAR_field,JML_BAYAR_field,CURRENCY_field],
			
	        buttons: [{
                iconCls: 'icon-save',
                itemId: 'save',
                text: 'Save',
                disabled: true,
                action: 'save'
            }, {
                iconCls: 'icon-add',
				itemId: 'create',
                text: 'Create',
                action: 'create'
            }, {
                iconCls: 'icon-reset',
                text: 'Cancel',
                action: 'cancel'
            }]
        });
        
        this.callParent();
    }
});